package com.guangli.ocr.viewmodel

import android.app.Application
import androidx.databinding.ObservableField
import com.guangli.base.base.vm.RobotBaseViewModel
import me.goldze.mvvmhabit.binding.command.BindingAction
import me.goldze.mvvmhabit.binding.command.BindingCommand
import me.goldze.mvvmhabit.bus.event.SingleLiveEvent

class DrivingLicenseViewModel(application: Application) : RobotBaseViewModel(application) {
    //证号
    val cardNum = ObservableField<String>()

    //姓名
    val name = ObservableField<String>()

    //性别
    val gender = ObservableField<String>()

    //国籍
    val nationality = ObservableField<String>()

    //出生日期
    val birth = ObservableField<String>()

    //住址
    val address = ObservableField<String>()

    //初次领证日期
    val issueDate = ObservableField<String>()

    //准驾车型
    val quasiDivingType = ObservableField<String>()

    //有效起始日期
    val validityDate = ObservableField<String>()

    //失效日期
    val expiryDate = ObservableField<String>()

    //发证单位
    val licenseIssuingUnit = ObservableField<String>()

    //副页姓名
    val deputyName = ObservableField<String>()

    //记录
    val record = ObservableField<String>()

    //证号
    val deputyCardNum = ObservableField<String>()

    //档案编号
    val fileNum = ObservableField<String>()
    val isAndThe = ObservableField<Boolean>(true)

//    val isAndTheLiveEvent = SingleLiveEvent<String>()
    val theOnclick = BindingCommand<Any>(BindingAction {
        isAndThe.set(false)
//        isAndTheLiveEvent.postValue("1")
        this.cardNum.set("")
        name.set("")
        gender.set("")
        nationality.set("")
        birth.set("")
        address.set("")
        issueDate.set("")
        quasiDivingType.set("")
        validityDate.set("")
        expiryDate.set("")
        licenseIssuingUnit.set("")
    })

    val isOnclick = BindingCommand<Any>(BindingAction {
        isAndThe.set(true)
//        isAndTheLiveEvent.postValue("0")
        this.cardNum.set("")
        record.set("")
        deputyCardNum.set("")
        fileNum.set("")
    })
}